#include "Kernel.h"
#include "Hal/IHardware.h"
#include "Hal/Memory.h"

void Memory_Set( void * dest, int value, Size size )
{
    byte * buffer = (byte *)dest;

    for( ; size > 0; size-- )
        *buffer++ = (byte)value;
}

void Memory_Copy( void * dest, void * src, Size size )
{
    byte * left = (byte *)dest;
    byte * right = (byte *)src;

    for( ; size > 0; size-- )
        *left++ = *right++;
}

int Memory_Compare( void * dest, void * src, Size size )
{
    byte * left = (byte *)dest;
    byte * right = (byte *)src;

    for( ; size > 0; size-- )
    {
        int diff = *left++ - *right++;

        if( diff != 0 )
            return diff;
    }

    return 0;
}
